package com.googlecode.classgrep.info;

import java.lang.annotation.Annotation;

public class AnnotationInfo extends Annotatable implements Info {
	private final String name;

	public AnnotationInfo(Annotation annotation) {
		this(annotation.getClass().getName());
	}

	public AnnotationInfo(Class<? extends Annotation> annotation) {
		this.name = annotation.getName().intern();
	}

	public AnnotationInfo(String name) {
		name = name.replaceAll("^L|;$", "");
		name = name.replace('/', '.');
		this.name = name.intern();
	}

	public String getName() {
		return name;
	}

	@Override
	public String toString() {
		return name;
	}
}